var http = require("../utils/http.js");

/** 获取个人中心信息 */
export function fetchUserCenter() {
  return http.request({
    url: "api/app/user/profile/",
    method: "GET",
    data: {}
  });
}
/** 获取个人中心信息 */
export function setUserNick(param) {
  return http.request({
    url: "api/app/user/nickname/",
    method: "POST",
    data: param
  });
}
/** 获取个人中心信息 */
export function setUserPhone(param) {
  return http.request({
    url: "api/app/user/nickphone/",
    method: "POST",
    data: param
  });
}
/** 获取个人中心信息 */
export function fetchPerson() {
  return http.request({
    url: "api/app/user/profile/",
    method: "GET",
    data: {}
  });
}
export function changeAvatar(param) {
  if (param && param.path) {
    return new Promise((resolve, reject) => {
      wx.uploadFile({
        url: domain + "api/app/user/avatar/",
        filePath: param.path,
        name: "file",
        success: function (res) {
          resolve(res);
        },
        fail: function (res) {
          reject(res)
        }
      })
    })
  }
}
export function wxlogin(param) {
  return http.request({
    url: "api/app/login/wechat/",
    method: "POST",
    data: param
  });
}